package com.yingside.collection;

import java.util.Hashtable;
import java.util.Map;
import java.util.TreeMap;

public class TestTreeMap {
    public static void main(String[] args) {
        Student s1 = new Student(1,"za1","12342341");
        Student s2 = new Student(2,"za2","12342342");
        Student s3 = new Student(3,"za3","12342343");
        Student s4 = new Student(4,"za4","12342344");

        //如果要把一个对象类型作为键，那么使用TreeMap和TreeSet意思一样
        //必须实现了Comparable接口
        Map<Student,Student> map = new TreeMap<>();
        map.put(s1,s1);
        map.put(s2,s2);
        map.put(s3,s3);
        map.put(s4,s4);

        System.out.println("map.get(1) = " + map.get(s1));

    }
}
